package org.reenscape.skill;
import org.reenscape.model.*;
import org.reenscape.lib.*;
import org.reenscape.updater.*;
public class Cooking {

		public void cook(int required, int id, int succ, int fail, int xp, String name, boolean fire, boolean burnable, PacketParser p3){
			if(p3.playerLevel[7] >= required){
				p3.deleteItem(id, p3.GetItemSlot(id), 1);
				p3.Animation(897);
				int Percent =  25 + (p3.playerLevel[7] - required);
				int Chance = (int) (java.lang.Math.random() * 100);
				
				if(!burnable) Chance = Percent;
				
  				if(Chance <= Percent) {
					if(!fire)	p3.sendMessage("You successfully cook "+name+".");
					if(fire)	p3.sendMessage("You cook "+name+" on the fire.");
					p3.addItem(succ, 1);
					p3.addSkillXP(xp, 7);
				}
				else {
					p3.sendMessage("You accidentally burn "+name+".");
					p3.addItem(fail, 1);
				}
			} else {
				p3.sendMessage("You need a cooking level of "+required+" to cook this item.");
			}
		}
		
		public void cook(boolean fire, int id, PacketParser p3){
			switch(id){
				/*BREAD*/
				case 2307:			cook(1, id, 2309, 2311, 40, "the bread dough", fire, true, p3);			break;
				/*FISH*/
				case 321:			cook(1, id, 319, 323, 40, "the anchovies", fire, true, p3);				break;
				case 317:			cook(1, id, 315, 323, 30, "the shrimp", fire, true, p3);				break;
				case 327:			cook(1, id, 325, 0, 40, "the sardines", fire, false, p3);				break;
				case 345:			cook(5, id, 347, 357, 50, "the herring", fire, true, p3);				break;
				case 353:			cook(10, id, 355, 357, 60, "the mackerel", fire, true, p3);				break;
				case 335:			cook(15, id, 333, 343, 70, "the trout", fire, true, p3);				break;
				case 341:			cook(18, id, 339, 343, 75, "the cod", fire, true, p3);					break;
				case 349:			cook(20, id, 351, 343, 80, "the pike", fire, true, p3);					break;
				case 331:			cook(25, id, 329, 343, 90, "the salmon", fire, true, p3);				break;
				case 359:			cook(30, id, 361, 367, 100, "the tuna", fire, true, p3);				break;
				case 377:			cook(40, id, 379, 381, 120, "the lobster", fire, true, p3);				break;
				case 363:			cook(43, id, 365, 367, 130, "the bass", fire, true, p3);				break;
				case 371:			cook(45, id, 373, 375, 140, "the swordfish", fire, true, p3);			break;
				case 2148:			cook(53, id, 2149, 0, 30, "the lava eel", fire, false, p3);				break;
				case 383:			cook(80, id, 385, 387, 210, "the shark", fire, true, p3);				break;
				case 395:			cook(82, id, 397, 399, 211, "the sea turtle", fire, true, p3);			break;
				case 389:			cook(91, id, 391, 393, 216, "the manta ray", fire, true, p3);			break;
				/*MEAT*/
				case 2132:			cook(1, id, 2142, 2146, 30, "the beef", fire, true, p3);				break;
				case 2134:			cook(1, id, 2142, 2146, 30, "the rat meat", fire, true, p3);			break;
				case 2136:			cook(1, id, 2141, 2146, 30, "the bear meat", fire, true, p3);			break;
				case 2138:			cook(1, id, 2140, 2144, 30, "the chicken", fire, true, p3);				break;
				default:			p3.sendMessage("Nothing interesting happens.");							break;
			}
		}
}